package com.monitorRoutine.monitorRoutineController.service;

import com.monitorRoutine.monitorRoutineController.entity.ControlCommand;
import org.eclipse.jgit.api.errors.GitAPIException;

import java.io.IOException;

public interface ExecuteCommandService {

    /**
     * 重启
     */
    void rebootComputer();

    /**
     * 执行python文件
     * @param filePath
     * @return
     * @throws IOException
     */
    Process startPython(String filePath) throws IOException;

    /**
     * 执行bat文件
     * @param filePath
     * @return
     * @throws IOException
     * @throws InterruptedException
     */
    boolean startBat(String filePath) throws IOException, InterruptedException;

    /**
     * 停止python文件运行
     * @param process
     * @return
     */
    boolean closurePython(Process process);

    /**
     * 传输文件
     * @param controlCommand
     * @return
     * @throws IOException
     */
    boolean transferringFiles(ControlCommand controlCommand) throws IOException;

    /**
     * 判断进程存在
     * @param name
     * @return
     */
    boolean processExists(String name);
    /**
     * 拉取代码
     * @param controlCommand
     * @return
     * @throws IOException
     * @throws GitAPIException
     * @throws Exception
     */
    boolean gitPull(ControlCommand controlCommand) throws IOException, GitAPIException, Exception;
}
